home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / Damage.py < prev    next >
Encoding:
Text File  |  2000-11-16  |  46.6 KB  |  1,364 lines

  1. import Reference
  2. import Bladex
  3. import copy
  4. import pdb
  5. import Blood
  6. import CharStats
  7. import Breakings
  8. import whrandom
  9. import Actions
  10. import netgame
  11. import Auras
  12. import GenFX
  13.  
  14.  
  15. if netgame.GetNetState() != 0:
  16.     import NetWeapon
  17.  
  18. PlayerHitFunc = ""
  19. PrintFormula=0
  20. PrintFatigue=0
  21.  
  22.  
  23.  
  24.  
  25. # Tabla de parametros para el efecto de impacto segun la animacion
  26. #aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch
  27.  
  28. InflictDamageFXData={}
  29.  
  30. ###############
  31. #  CABALLERO  #
  32. ###############
  33. #espadaromana
  34. InflictDamageFXData['Kgt_g_27kata_new']=(250.0, 0.7, 240, 20, 0, 2.0, None, 1.0, 1.0)
  35.  
  36.  
  37.  
  38. # Attacking Anim Table   (Damage Factor)
  39. AnimationData={}         #############
  40.  
  41. ###############
  42. #   BARBARO   #
  43. ###############
  44. #inicio
  45. AnimationData['Bar_g2h_08']=   1.0
  46.  
  47. #combos arriba
  48. AnimationData['Bar_g2h_b6kata']=  1.25
  49. AnimationData['Bar_g2h_b7']=  2.8
  50.  
  51. #combos derecha
  52. AnimationData['Bar_g2h_s7']=  1.0
  53. AnimationData['Bar_g2h_02kata']=  1.2
  54.  
  55. #combos izquierda
  56. AnimationData['Bar_g2h_11']=   1.0
  57. AnimationData['Bar_g2h_01']=   1.8
  58.  
  59. #combos bajo
  60. AnimationData['Bar_g2h_12low']=   1.0
  61. AnimationData['Bar_g2h_02low']=   2.0
  62.  
  63. #deathsword
  64. AnimationData['Bar_g2h_b6low']=   8.0
  65.  
  66. #chaossword
  67. AnimationData['Bar_g2h_b6']=   8.0
  68.  
  69. #bigsword
  70. AnimationData['Bar_g2h_b29']=  10.0
  71. AnimationData['Bar_g2h_s7']=   1.0
  72. AnimationData['Bar_g2h_19']=  10.0
  73.  
  74. #longsword
  75. AnimationData['Bar_g2h_13']=    7.0
  76.  
  77. #alfange
  78. AnimationData['Bar_g2h_s8']=   7.0
  79. AnimationData['Bar_g2h_26']=   10.0
  80.  
  81. #flatsword
  82. AnimationData['Bar_g2h_28']=   10.0
  83. AnimationData['Bar_g2h_17']=   10.0
  84. AnimationData['Bar_g2h_b7']=   10.0
  85.  
  86. #sawsword
  87. AnimationData['Bar_g2h_21_7']=   8.0
  88. #AnimationData['Bar_g2h_b6kata']=   70.0
  89.  
  90. #firebigsword
  91. AnimationData['Bar_g2h_21_2']=   21.0
  92. AnimationData['Bar_g2h_earthpow']=   60.0
  93.  
  94. #comborapidoextra1
  95. AnimationData['Bar_g2h_21_6kata']=   3.0
  96. #comborapidoextra2
  97. AnimationData['Bar_g2h_26_b6']=   3.5
  98.  
  99.  
  100. #sin utilizar
  101. AnimationData['Bar_g2h_02']=   10.0
  102.  
  103.  
  104. # HACHAS #
  105. #inicio
  106. AnimationData['Bar_g_axe08']=   1.0
  107.  
  108. #arriba
  109. AnimationData['Bar_g_axe18']=   1.0
  110. AnimationData['Bar_g_axe01']=  2.6
  111. #AnimationData['Bar_g_axe08strong']= 1.2
  112.  
  113. #derecha
  114. AnimationData['Bar_g_axe02']=   1.0
  115.  
  116. #izquierda
  117. AnimationData['Bar_g_axe13']=   1.0
  118.  
  119. #abajo
  120. AnimationData['Bar_g_axe111']=   1.0
  121. AnimationData['Bar_g_axe_2katab6low']=  30.0
  122.  
  123. #comboaleatorioextra
  124. AnimationData['Bar_g_axe31']=   3.2
  125.  
  126. #hacharrajada
  127. AnimationData['Bar_g_axe32']=  9.0
  128. AnimationData['Bar_g_axe_26kata']=   9.0
  129. AnimationData['Bar_g_axe_3s2']=   9.0
  130.  
  131. #eclipse
  132. AnimationData['Bar_g_axe211']=   10.0
  133.  
  134. #guadanya
  135. AnimationData['Bar_g_axe33']=   7.0
  136.  
  137. #rhinoclub
  138. AnimationData['Bar_g_axe12']=  10.0
  139.  
  140. #hacha2hojas
  141. AnimationData['Bar_g_axe34']=  8.0
  142. AnimationData['Bar_g_axe_32kata_b2']=   8.0
  143.  
  144. #iceaxe
  145. AnimationData['Bar_g_axe30']=   34.0
  146.  
  147. #sin utilizar
  148. AnimationData['Bar_g_axe28']=   1.0
  149.  
  150. #esquivas y ataque 180
  151. AnimationData['Bar_g2h_d_r']=   2.0
  152. AnimationData['Bar_g2h_d_l']=   2.0
  153. AnimationData['Bar_g_d_r_axe']=   2.0
  154. AnimationData['Bar_g_d_l_axe']=   2.0
  155. AnimationData['Bar_g2h_back']=   2.0
  156.  
  157. #golpes sin armas
  158. AnimationData['Bar_g_punch1']=   2.0
  159. AnimationData['Bar_g_punch2']=   2.0
  160. AnimationData['Bar_g_punch3']=   2.0
  161. AnimationData['Bar_g_punch4']=   2.0
  162. AnimationData['Bar_g_kick']=   2.0
  163. AnimationData['Bar_g_magic']=   37.5
  164. AnimationData['Bar_g_magic2']=   21.0
  165.  
  166. #armas no afines
  167. AnimationData['Bar_g_07']=   1.0
  168. AnimationData['Bar_g_11']=   1.3
  169. AnimationData['Bar_g_16']=   1.4
  170. AnimationData['Bar_g_17']=   1.2
  171. AnimationData['Bar_g_18']=   1.2
  172. AnimationData['Bar_g_06lowkata_new']=   10.0
  173.  
  174. ###############
  175. #  CABALLERO  #
  176. ###############
  177. AnimationData['Kgt_g_08_new']=  1.0
  178. AnimationData['Kgt_g_01_7_new']=   1.5
  179. AnimationData['Kgt_g_07_new']=  1.0
  180. AnimationData['Kgt_g_s3_new']=   2.8
  181. AnimationData['Kgt_g_12_new']=  1.0
  182. AnimationData['Kgt_g_02_new']=   2.0
  183. AnimationData['Kgt_g_b06_new']=  1.0
  184. AnimationData['Kgt_g_19_bs1_new']=   2.3
  185. AnimationData['Kgt_g_01low_new']=  1.0
  186. AnimationData['Kgt_g_22lowkata_new']=   2.5
  187.  
  188. #gladius
  189. AnimationData['Kgt_g_28new']=   7.5
  190. #maza
  191. AnimationData['Kgt_g_01_new']=   13.0
  192. #espadaromana
  193. AnimationData['Kgt_g_27kata_new']=   10.0
  194. #elfsword
  195. AnimationData['Kgt_g_32_5_3new']=   8.5
  196. #maza2
  197. AnimationData['Kgt_g_21_6_s8new']=   9.0
  198. #hooksword
  199. AnimationData['Kgt_g_s22low_new']=   10.0
  200. #espadacurva
  201. AnimationData['Kgt_g_sb25_new']=   10.0
  202. #dagesse
  203. AnimationData['Kgt_g_s19_new']=   11.0
  204. #cimitarra
  205. AnimationData['Kgt_g_18_11_22_new']=  10.0
  206. #maza3
  207. AnimationData['Kgt_g_b32kata_new']=  10.0
  208. #doublesword
  209. AnimationData['Kgt_g_22kata_23_new']=  8.0
  210. #espadafilo
  211. AnimationData['Kgt_g_09_07_s6low_new']=  9.0
  212. #espada
  213. AnimationData['Kgt_g_29_3new']=   9.0
  214. #queensword
  215. AnimationData['Kgt_g_06lowkata_new']=   10.0
  216. #icesword
  217. AnimationData['Kgt_g_12_7_s1new']=   70.0
  218. #firesword
  219. AnimationData['Kgt_g_s28kata_new']=   30.0
  220.  
  221. AnimationData['Kgt_g_3s9_6new']=  3.5
  222. AnimationData['Kgt_g_back']=   1.8
  223. AnimationData['Kgt_g_bad_axe']=   1.6
  224. AnimationData['Kgt_g_bad_sword']=   1.0
  225. AnimationData['Kgt_g_bad_sword2']=   1.3
  226. AnimationData['Kgt_g_bad_sword3']=   1.5
  227. AnimationData['Kgt_g_bad_spear']=   1.9
  228. AnimationData['Kgt_g_bad_spear2']=   1.9
  229.  
  230. AnimationData['Kgt_g_punch1']=   1.2
  231. AnimationData['Kgt_g_punch2']=   1.2
  232. AnimationData['Kgt_g_kick']=   1.2
  233.  
  234. AnimationData['Kgt_g_d_r']=   1.2
  235. AnimationData['Kgt_g_d_l']=   1.2
  236.  
  237. AnimationData['Kgt_g_magic']=   37.5
  238. AnimationData['Kgt_g_magic2']=  21.0
  239. AnimationData['Kgt_g_08']=   1.0
  240. AnimationData['Kgt_g_06']=   1.3
  241. AnimationData['Kgt_g_02']=   1.2
  242. AnimationData['Kgt_g_07']=   1.3
  243. AnimationData['Kgt_g_05']=   1.2
  244.  
  245. #############
  246. #  AMAZONA  #
  247. #############
  248. #inicio
  249. AnimationData['Amz_g_spears1']=  1.0
  250.  
  251. #arriba
  252. AnimationData['Amz_g_spear08']=  1.0
  253.  
  254. #derecha
  255. AnimationData['Amz_g_spear12']=  1.0
  256.  
  257. #izquierda
  258. AnimationData['Amz_g_spears6']=  1.0
  259.  
  260. #abajo
  261. AnimationData['Amz_g_spear16low']=  1.0
  262.  
  263.  
  264. #EXRA ARMAS
  265. #BO
  266. AnimationData['Amz_g_spears8']=  5.0
  267. #BICHERO
  268. AnimationData['Amz_g_spear_2katab6low']= 13.0
  269. #LANZA
  270. AnimationData['Amz_g_spear19']= 10.0
  271. #NAGINATA
  272. AnimationData['Amz_g_spear22']=  8.6
  273. #TRIDENTE
  274. AnimationData['Amz_g_spear09']=  8.0
  275. #AXPEAR
  276. AnimationData['Amz_g_spear32kata_b2']= 9.0
  277. #DEATHBO
  278. AnimationData['Amz_g_spear_kata23']=   9.0
  279. #CROSSPEAR
  280. AnimationData['Amz_g_spear13']=  11.0
  281. #HACHACUCHILLA
  282. AnimationData['Amz_g_spear3s2']= 11.0
  283. #CRUSHBO
  284. AnimationData['Amz_g_spear_21']=   10.0
  285. #ARPON
  286. AnimationData['Amz_g_spear_b29']= 9.0
  287. #NAGINATA2
  288. AnimationData['Amz_g_spear33']=  7.8
  289. #LANZAHANCHA
  290. AnimationData['Amz_g_spear_sb11']=   9.0
  291. #FIREBO
  292. AnimationData['Amz_g_spear_b6_26']= 37.0
  293. #STEELFEATHER
  294. AnimationData['Amz_g_spear19_bs1']=  65.0
  295. #ICEWAND
  296. AnimationData['Amz_g_spear16']=  35.0
  297.  
  298. #QUEENSWORD
  299. AnimationData['Amz_g_06lowkata_new']=  10.0
  300.  
  301. #extragolpe
  302. AnimationData['Amz_g_spear26kata']= 2.9
  303.  
  304. #180
  305. AnimationData['Amz_g_spear_back']= 2.0
  306.  
  307. #golpes torpes
  308. AnimationData['Amz_g_bad_axe']=  1.0
  309. AnimationData['Amz_g_bad_sword']=  1.0
  310. AnimationData['Amz_g_bad_sword2']=  1.0
  311. AnimationData['Amz_g_bad_sword3']= 1.0
  312.  
  313. #golpes arma 1 mano
  314. AnimationData['Amz_g_09']=   1.0
  315. AnimationData['Amz_g_05']=   1.2
  316. AnimationData['Amz_g_02']=   1.2
  317. AnimationData['Amz_g_06']=   1.2
  318. AnimationData['Amz_g_07']=   1.2
  319. AnimationData['Amz_g_magic']=   37.5
  320. AnimationData['Amz_g_magic2']=   21.0
  321.  
  322.  
  323. #golpes sin armas
  324. AnimationData['Amz_g_punch2']=   1.0
  325. AnimationData['Amz_g_kick1']=   1.5
  326. AnimationData['Amz_g_kick2']=   1.0
  327.  
  328. #sin utilizar
  329. AnimationData['Amz_g_spear111']=   1.0
  330. AnimationData['Amz_g_spear17']=   1.0
  331. AnimationData['Amz_g_spear19_13']=   1.0
  332. AnimationData['Amz_g_spear_b06']=   1.0
  333. AnimationData['Amz_g_spear_bs21']=   1.0
  334. AnimationData['Amz_g_spear02']=   1.0
  335.  
  336.  
  337. ###########
  338. #  ENANO  #
  339. ###########
  340. AnimationData['Dwf_g_08']=   1.0
  341. AnimationData['Dwf_g_01']=   1.0
  342. AnimationData['Dwf_g_01low_new']=   1.0
  343. AnimationData['Dwf_g_02']=   1.0
  344. AnimationData['Dwf_g_05']=   8.0
  345. AnimationData['Dwf_g_06']=   1.0
  346. AnimationData['Dwf_g_07']=   11.0
  347. AnimationData['Dwf_g_09']=   38.0
  348. AnimationData['Dwf_g_01a']=   1.0
  349. AnimationData['Dwf_g_02a']=   1.0
  350. AnimationData['Dwf_g_05a']=   1.0
  351. AnimationData['Dwf_g_06a']=   1.0
  352. AnimationData['Dwf_g_07a']=   1.0
  353. AnimationData['Dwf_g_09a']=   1.0
  354. AnimationData['Dwf_g_18']=   9.2
  355. AnimationData['Dwf_g_15']=   6.0
  356. AnimationData['Dwf_g_14']=   4.5
  357. AnimationData['Dwf_g_13']=   10.5
  358. AnimationData['Dwf_g_16']=   7.8
  359. AnimationData['Dwf_g_11']=   8.0
  360. AnimationData['Dwf_g_12']=   9.2
  361. AnimationData['Dwf_g_17']=   9.0
  362. AnimationData['Dwf_g_21']=   9.0
  363. AnimationData['Dwf_g_22']=   70.0
  364. AnimationData['Dwf_g_23']=   1.5
  365. AnimationData['Dwf_g_26']=   1.5
  366. AnimationData['Dwf_g_27']=   1.5
  367. AnimationData['Dwf_g_31']=   8.0
  368.  
  369. AnimationData['Dwf_g_back']=   1.0
  370. AnimationData['Dwf_g_s18_2h']=   1.0
  371. AnimationData['Dwf_g_32_5_3new']=   1.0
  372. AnimationData['Dwf_g_s22low_new']=   50.0
  373. AnimationData['Dwf_g_s3_new']=   12.0
  374. AnimationData['Dwf_g_27kata']=   1.0
  375. AnimationData['Dwf_g_12low']=   1.0
  376. AnimationData['Dwf_g_s11']=   1.0
  377. AnimationData['Dwf_g_06lowkata_new']=   10.0
  378. AnimationData['Dwf_g_magic']=   37.5
  379. AnimationData['Dwf_g_magic2']=   21.0
  380.  
  381. #Golpes Torpes
  382. AnimationData['Dwf_g_bad_axe']=   1.0
  383. AnimationData['Dwf_g_bad_spear']=   1.0
  384. AnimationData['Dwf_g_bad_spear2']=   1.0
  385. AnimationData['Dwf_g_bad_sword']=   1.0
  386. AnimationData['Dwf_g_bad_sword1']=   1.0
  387. AnimationData['Dwf_g_bad_sword2']=   1.0
  388. AnimationData['Dwf_g_bad_sword3']=   1.0
  389. AnimationData['Dwf_g_bad_no']=   1.0
  390. AnimationData['Dwf_g_bad_1h']=   1.0
  391.  
  392. #Ataques instantaneos
  393. AnimationData['Dwf_g_draw_rlx']=   1.0
  394. AnimationData['Dwf_g_draw_run']=   1.0
  395.  
  396. #Esquivas
  397. AnimationData['Dwf_g_d_r']=   2.0
  398. AnimationData['Dwf_g_d_l']=   2.0
  399.  
  400. #golpes sin armas
  401. AnimationData['Dwf_g_punch1']=   1.0
  402. AnimationData['Dwf_g_punch2']=   1.0
  403. AnimationData['Dwf_g_kick']=   1.0
  404.  
  405.  
  406. ##########
  407. #  ORCO  #
  408. ##########
  409. AnimationData['Ork_g_01']=   1.0
  410. AnimationData['Ork_g_02']=   1.0
  411. AnimationData['Ork_g_06']=   1.0
  412. AnimationData['Ork_g_15']=   1.2
  413. AnimationData['Ork_g_16']=   1.5
  414. AnimationData['Ork_g_18']=   1.8
  415. ###############
  416. #  GRAN ORCO  #
  417. ###############
  418. AnimationData['Gok_g_01']=   1.0
  419. AnimationData['Gok_g_02']=   1.2
  420. AnimationData['Gok_g_06']=   1.3
  421. AnimationData['Gok_g_15']=   2.0
  422. AnimationData['Gok_g_16']=   2.5
  423. AnimationData['Gok_g_18']=   3.0
  424.  
  425. ###############
  426. #  ESQUELETO  #
  427. ###############
  428. AnimationData['Skl_g_01']=    1.0
  429. AnimationData['Skl_g_02']=    1.2
  430. AnimationData['Skl_g_07']=    1.3
  431. AnimationData['Skl_g_09']=    1.5
  432. AnimationData['Skl_g_16']=    2.1
  433. AnimationData['Skl_g_18']=    1.8
  434. AnimationData['Skl_g_22']=    2.0
  435.  
  436. ##########
  437. #  LICH  #
  438. ##########
  439. AnimationData['Lch_g_12']=    2.8
  440. AnimationData['Lch_g_13']=    2.8
  441. AnimationData['Lch_g_16']=    2.8
  442. AnimationData['Lch_g_18']=    2.8
  443.  
  444. ###########
  445. #  ZOMBI  #
  446. ###########
  447. AnimationData['Zkn_g_12']=    3.6
  448. AnimationData['Zkn_g_13']=    3.8
  449. AnimationData['Zkn_g_16']=    3.6
  450. AnimationData['Zkn_g_18']=    3.7
  451.  
  452. #######################
  453. #  Caballero Traidor  #
  454. #######################
  455. AnimationData['Tkn_g_01']=    1.0
  456. AnimationData['Tkn_g_02']=    1.2
  457. AnimationData['Tkn_g_07']=    1.3
  458. AnimationData['Tkn_g_08']=    1.4
  459. AnimationData['Tkn_g_13']=    1.6
  460. AnimationData['Tkn_g_14']=    2.3
  461. AnimationData['Tkn_g_16']=    2.5
  462. AnimationData['Tkn_g_18']=    2.6
  463.  
  464. #####################
  465. #  Caballero Negro  #
  466. #####################
  467. AnimationData['Dkn_g_01']=    1.0
  468. AnimationData['Dkn_g_02']=    1.2
  469. AnimationData['Dkn_g_07']=    1.2
  470. AnimationData['Dkn_g_08']=    1.3
  471. AnimationData['Dkn_g_13']=    1.5
  472. AnimationData['Dkn_g_14']=    1.6
  473. AnimationData['Dkn_g_16']=    1.8
  474. AnimationData['Dkn_g_18']=    1.95
  475.  
  476. ############
  477. #  RAGNAR  #
  478. ############
  479. AnimationData['Rgn_g_01']=    1.0
  480. AnimationData['Rgn_g_02']=    1.0
  481. AnimationData['Rgn_g_03']=    1.0
  482. AnimationData['Rgn_g_07']=    1.0
  483. AnimationData['Rgn_g_d_r']=   1.5
  484. AnimationData['Rgn_g_d_l']=   1.5
  485. AnimationData['Rgn_g_escape']=   2.5
  486. AnimationData['Rgn_g_17']=    1.6
  487. AnimationData['Rgn_g_21']=    1.5
  488.  
  489. #################
  490. #  TROLL NEGRO  #
  491. #################
  492. AnimationData['Trl_g_01']=    1.0
  493. AnimationData['Trl_g_02']=    1.2
  494. AnimationData['Trl_g_04']=    1.4
  495. AnimationData['Trl_g_06']=    1.6
  496. AnimationData['Trl_g_12']=    2.8
  497. AnimationData['Trl_g_18']=    3.4
  498. AnimationData['Trl_g_19']=    1.8
  499. AnimationData['Trl_g_31']=    4.8
  500.  
  501. ###############
  502. #  MINOTAURO  #
  503. ###############
  504. AnimationData['Min_g_01']=    1.0
  505. AnimationData['Min_g_07']=    1.2
  506. AnimationData['Min_g_08']=    1.5
  507. AnimationData['Min_g_12']=    3.0
  508. AnimationData['Min_g_31']=    2.8
  509.  
  510. ####################
  511. #  Caballero CAOS  #
  512. ####################
  513. AnimationData['Chk_g_magic']=    15.0
  514. AnimationData['Chk_g_01']=    1.0
  515. AnimationData['Chk_g_02']=    1.2
  516. AnimationData['Chk_g_07']=    1.0
  517. AnimationData['Chk_g_08']=    1.2
  518. AnimationData['Chk_g_12']=    2.0
  519. AnimationData['Chk_g_18']=    2.5
  520. AnimationData['Chk_g_31']=    4.0
  521.  
  522. ##################
  523. #  GOLEM PIEDRA  #
  524. ##################
  525. AnimationData['Glm_g_01']=    15.0
  526. AnimationData['Glm_g_114']=    20.0
  527. AnimationData['Glm_g_12']=    20.0
  528. AnimationData['Glm_g_21']=    10.0
  529. AnimationData['Glm_g_21_27']=    7.0
  530. AnimationData['Glm_g_31']=    30.0
  531. AnimationData['Glm_g_spit']=    10.0
  532. AnimationData['Glm_g_1tw']=    10.0
  533.  
  534. ###################
  535. #  DEMONIO MENOR  #
  536. ###################
  537. AnimationData['Ldm_g_spit']=    3.5
  538. AnimationData['Ldm_g_03']=    1.0
  539. AnimationData['Ldm_g_06']=    1.2
  540. AnimationData['Ldm_g_07']=    1.3
  541. AnimationData['Ldm_g_22']=   3.0
  542. AnimationData['Ldm_g_27']=   2.5
  543. AnimationData['Ldm_g_jumpl']=    1.3
  544. AnimationData['Ldm_g_jumpr']=    1.3
  545.  
  546.  
  547. ######
  548. #AnimationData['g_01']=   0.3
  549. #AnimationData['g_02']=   0.3
  550. AnimationData['g_03']=   0.3
  551. AnimationData['g_04']=   0.3
  552. AnimationData['g_05']=   0.3
  553. AnimationData['g_06']=   0.3
  554. #AnimationData['g_07']=   0.3
  555. #AnimationData['g_08']=   0.3
  556. AnimationData['g_09']=   0.3
  557. AnimationData['g_10']=   1.0
  558. AnimationData['g_11']=   1.0
  559. AnimationData['g_12']=   1.0
  560. #AnimationData['g_13']=   1.0
  561. #AnimationData['g_14']=   1.0
  562. AnimationData['g_15']=   1.0
  563. #AnimationData['g_16']=   1.5
  564. AnimationData['g_17']=   1.0
  565. #AnimationData['g_18']=   1.0
  566. AnimationData['g_19']=   1.0
  567. AnimationData['g_21']=   2.5
  568. AnimationData['g_22']=   2.5
  569. AnimationData['g_23']=   2.5
  570. AnimationData['g_24']=   2.5
  571. AnimationData['g_25']=   2.5
  572. AnimationData['g_26']=   2.5
  573. AnimationData['g_27']=   2.5
  574. AnimationData['g_31']=   3.5
  575.  
  576. #AnimationData['g_magic']=   5.3
  577. #AnimationData['g_magic2']=   5.3
  578.  
  579. ################################################################################
  580. # Special Damage Functions
  581. # takes:  special damage data, victim resistance, effective normal damage, standard CalcDamage args
  582. # returns: damage points to inflict now.
  583.  
  584. def InflictFireDamage (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):    
  585.     # Do nothing if not activated by combo
  586.     fire_activated=1
  587.  
  588.     if fire_activated:
  589.  
  590.         # Yellow/Red halo effect on victim
  591.         time=Bladex.GetTime()
  592.         aura=Auras.MakeAura(VictimName,0.8,   (1  , 0.01, 1.0, 0, 0, 1), (), (), (2,  0.8, 0.6, 0.0, 0.6, 0.2  ,  0.8, 0.1, 0.0, 0.0, 0.8))
  593.         aura.Data.AddEvent(time+0.15,         (100, 1.0 , 1.0, 0, 0, 1), (), (), (2,  0.8, 0.6, 0.0, 0.6, 0.2  ,  0.8, 0.1, 0.0, 0.0, 0.8))
  594.         aura.Data.AddEvent(time+0.8,          (160, 0.01, 1.0, 0, 0, 1), (), (), (2,  0.8, 0.1, 0.0, 0.6, 0.2  ,  0.8, 0.0, 0.0, 0.0, 0.8))
  595.         prtl=Bladex.CreateEntity(aura.Name+"Particles", "Entity Particle System Dperson", 0, 0, 0)
  596.         prtl.PersonName=VictimName
  597.         prtl.ParticleType="Llamita2"
  598.         prtl.PPS=400
  599.         prtl.Velocity=0.0, 0.0, 0.0
  600.         prtl.NormalVelocity=2.0
  601.         prtl.RandomVelocity=0.0
  602.         prtl.YGravity=-200.0
  603.         prtl.Friction=0.02
  604.         prtl.FollowFactor=0.0
  605.         prtl.Time2Live=21
  606.         prtl.DeathTime=Bladex.GetTime()+0.2
  607.  
  608.         special_damage= special[1]*(1.0-special_resistance)
  609.         if special_damage>0:
  610.             victim= Bladex.GetEntity(VictimName)
  611.             if victim and victim.Person and victim.Data:
  612.                 victim.Data.LastDamageType= special[0]
  613.         return special_damage
  614.  
  615.     return 0.0
  616.  
  617. def InflictIceDamage (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  618.     # Do nothing if not activated by combo
  619.     ice_activated=1
  620.  
  621.     if ice_activated:
  622.  
  623.         # Blue/White halo effect on victim
  624.         time=Bladex.GetTime()
  625.         aura=Auras.MakeAura(VictimName,0.7,   (1 , 0.01, 1.0, 0, 0, 1), (), (), (2,  0.8, 0.9, 1.0, 0.6, 0.3  ,  0.2, 0.6, 0.8, 0.4, 1.0))
  626.         aura.Data.AddEvent(time+0.1,          (30, 1.0 , 1.0, 0, 0, 1), (), (), (2,  0.8, 0.9, 1.0, 0.6, 0.3  ,  0.2, 0.6, 0.8, 0.4, 1.0))
  627.         aura.Data.AddEvent(time+0.7,          (60, 0.01, 1.0, 0, 0, 1), (), (), (2,  0.2, 0.4, 0.8, 0.6, 0.4  ,  0.0, 0.2, 0.8, 0.4, 0.5))
  628.  
  629.         special_damage= special[1]*(1.0-special_resistance)
  630.         if special_damage>0:
  631.             victim= Bladex.GetEntity(VictimName)
  632.             if victim and victim.Person and victim.Data:
  633.                 victim.Data.LastDamageType= special[0]
  634.         return special_damage
  635.  
  636.     return 0.0
  637.  
  638. def InflictVenomDamage (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  639.     if not (Shielded and effective_damage<=0.0):
  640.         victim= Bladex.GetEntity(VictimName)
  641.         if victim and victim.Person and victim.Data:
  642.             # Effects in Basic_Funcs.py        
  643.             venom_damage= special[1]
  644.             victim.Data.EnVenom (VictimName, venom_damage, AttackerName)
  645.     
  646.     return 0         # Does not inflict immediate damage
  647.  
  648. def InflictDrainDamage (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  649.     weapon= Bladex.GetEntity(WeaponName)
  650.     victim= Bladex.GetEntity(VictimName)
  651.     holder= Bladex.GetEntity(AttackerName)        
  652.     LastDamage= min (effective_damage, victim.Life)
  653.     if weapon and victim and holder and LastDamage>0:
  654.         # weapon gives life to user
  655.         holder.Life= min(holder.Life+LastDamage, CharStats.GetCharMaxLife(holder.Kind, holder.Level))
  656.         
  657.         # Red halo effect on weapon
  658.         # ...
  659.         
  660.         # Can we do a streaming blood effect
  661.         # ...        
  662.         time=Bladex.GetTime()
  663.         aura= Auras.MakeAura (VictimName,1.5,    (55,1.0,1.0,1,0,0), (),(),(2,  0.6,0.0,0.0, 0.5, 0.0  , 0.6,0.0,0.0, 0.1, 0.1))    
  664.         # expand the blood through the skin    
  665.         aura.Data.AddEvent(time+1.0,             (55,0.8,1.0,1,0,0), (),(),(2,  0.6,0.0,0.0, 0.5, 0.0  , 0.6,0.0,0.0, 0.1, 1.0))    
  666.         # disperse the blood through the air
  667.         aura.Data.AddEvent(time+1.5,             (255,0.0,1.0,1,0,0), (),(),(2,  0.6,0.0,0.0, 0.5, 0.0  , 0.6,0.0,0.0, 0.1, 1.0))
  668.         
  669.         # more aura effects on holder in ItemTypes.py:VampWeapon
  670.         
  671.     return 0         # Does not inflict extra damage, just gives the life drained to the user
  672.  
  673. def InflictElectricDamage (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):    
  674.     # halo effect on victim, must be switched off on death
  675.     special_damage= special[1]*(1.0-special_resistance)
  676.     if special_damage>0:
  677.         victim= Bladex.GetEntity(VictimName)
  678.         if victim and victim.Person and victim.Data:
  679.             victim.Data.LastDamageType= special[0]
  680.     return special_damage    
  681.  
  682. def InflictLightDamage (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  683.     # Do nothing if not activated by combo
  684.     light_activated=1
  685.  
  686.     if light_activated:
  687.  
  688.         time=Bladex.GetTime()
  689.         aura=Auras.MakeAura(VictimName,0.7,   (1  , 0.01, 1.0, 0, 0, 1), (), (), (2,  0.8, 0.9, 1.0, 0.6, 0.3  ,  0.2, 0.6, 0.8, 0.4, 1.0))
  690.         aura.Data.AddEvent(time+0.1,          (120, 1.0 , 1.0, 0, 0, 1), (), (), (2,  0.8, 0.9, 1.0, 0.6, 0.3  ,  0.2, 0.6, 0.8, 0.4, 1.0))
  691.         aura.Data.AddEvent(time+0.7,          (240, 0.01, 1.0, 0, 0, 1), (), (), (2,  0.2, 0.4, 0.8, 0.6, 0.4  ,  0.0, 0.2, 0.8, 0.4, 0.5))
  692.         prtl=Bladex.CreateEntity(aura.Name+"Particles", "Entity Particle System Dperson", 0, 0, 0)
  693.         prtl.PersonName=VictimName
  694.         prtl.ParticleType="BrillosBladeSword"
  695.         prtl.PPS=200
  696.         prtl.Velocity=0.0, 0.0, 0.0
  697.         prtl.NormalVelocity=5.0
  698.         prtl.RandomVelocity=0.0
  699.         prtl.YGravity=0.0
  700.         prtl.Friction=0.01
  701.         prtl.FollowFactor=0.0
  702.         prtl.Time2Live=8
  703.         prtl.DeathTime=Bladex.GetTime()+0.4
  704.  
  705.         special_damage= special[1]*(1.0-special_resistance)
  706.         if special_damage>0:
  707.             victim= Bladex.GetEntity(VictimName)
  708.             if victim and victim.Person and victim.Data:
  709.                 victim.Data.LastDamageType= special[0]
  710.         return special_damage
  711.  
  712.     return 0.0
  713.  
  714.  
  715. SpecialDamageFuncs={}
  716. SpecialDamageFuncs['Fire']    = InflictFireDamage
  717. SpecialDamageFuncs['Ice']     = InflictIceDamage
  718. SpecialDamageFuncs['Venom']   = InflictVenomDamage
  719. SpecialDamageFuncs['Drain']   = InflictDrainDamage
  720. SpecialDamageFuncs['Electric']= InflictElectricDamage
  721. SpecialDamageFuncs['Light']   = InflictLightDamage
  722.  
  723.  
  724. def DropInvalidObjectsOnImpact(EntityName):
  725.     me=Bladex.GetEntity(EntityName)
  726.     if me:
  727.         Actions.UnGraspString (EntityName,"UnGraspString")
  728.         Actions.Stop_Weapon (EntityName,"Stop_Weapon")
  729.         if me.InvRight:
  730.             right_type= Reference.GiveObjectFlag(me.InvRight)
  731.             if right_type==Reference.OBJ_ITEM \
  732.             or right_type==Reference.OBJ_SHIELD \
  733.             or right_type==Reference.OBJ_QUIVER \
  734.             or right_type==Reference.OBJ_BOW \
  735.             or right_type==Reference.OBJ_KEY \
  736.             or right_type==Reference.OBJ_SPECIALKEY \
  737.             or right_type==Reference.OBJ_USEME \
  738.             or right_type==Reference.OBJ_SPECIALKEY \
  739.             or right_type==Reference.OBJ_TABLET:
  740.                 Actions.DropReleaseEventHandler (EntityName, "DropRightEvent")
  741.         if me.InvLeft:
  742.             left_type= Reference.GiveObjectFlag(me.InvLeft)
  743.             if left_type==Reference.OBJ_ITEM \
  744.             or (left_type==Reference.OBJ_WEAPON and me.InvRight != me.InvLeft) \
  745.             or (left_type==Reference.OBJ_STANDARD and me.InvRight != me.InvLeft) \
  746.             or left_type==Reference.OBJ_QUIVER \
  747.             or left_type==Reference.OBJ_KEY \
  748.             or left_type==Reference.OBJ_SPECIALKEY \
  749.             or left_type==Reference.OBJ_USEME \
  750.             or left_type==Reference.OBJ_SPECIALKEY \
  751.             or left_type==Reference.OBJ_TABLET:
  752.                 Actions.DropReleaseEventHandler (EntityName, "DropLeftEvent")
  753.  
  754.  
  755. def BreakMyShield(EntityName):
  756.     me=Bladex.GetEntity(EntityName)
  757.     if me.InvLeft<>"":        
  758.         if Breakings.ExplodeSpecialObject ( me.InvLeft , 24000.0)==1:
  759.             if Reference.EntitiesObjectData.has_key(me.InvLeft):
  760.                 del Reference.EntitiesObjectData[me.InvLeft]
  761.             DropInvalidObjectsOnImpact (EntityName)
  762.             me.Wuea=Reference.WUEA_ENDED
  763.             me.LaunchAnmType("df_s_broken")
  764.             inv=me.GetInventory()
  765.             inv.RemoveShield(me.InvLeft)
  766.             inv.LinkLeftHand("None")
  767.             if me.Data.NPC:
  768.                 me.Data.ResetCombat (EntityName)
  769.  
  770.  
  771. def BreakMySword(EntityName):
  772.     me=Bladex.GetEntity(EntityName)
  773.     if me.InvRight<>"":        
  774.         Actions.Stop_Weapon (EntityName,"Stop_Weapon")
  775.         if Breakings.ExplodeSpecialObject ( me.InvRight , 24000.0)==1:
  776.             if Reference.EntitiesObjectData.has_key(me.InvRight):
  777.                 del Reference.EntitiesObjectData[me.InvRight]
  778.             DropInvalidObjectsOnImpact (EntityName)
  779.             me.Wuea=Reference.WUEA_ENDED
  780.             me.LaunchAnmType("sword_broken")
  781.             inv=me.GetInventory()
  782.             inv.RemoveWeapon(me.InvRight)
  783.             inv.LinkRightHand("None")
  784.             if me.Data.NPC:
  785.                 me.Data.ResetCombat (EntityName)
  786.  
  787. def StuckWeaponFall (WeaponName, TargetName):
  788.     weapon= Bladex.GetEntity(WeaponName)
  789.     if weapon:        
  790.         if weapon.Parent==TargetName:
  791.             target= Bladex.GetEntity(TargetName)
  792.             if target:
  793.                 target.Unlink(weapon)
  794.                 if target.Person:
  795.                     weapon.ExcludeHitFor(target)
  796.                 elif target.Parent:
  797.                     parent= Bladex.GetEntity(target.Parent)
  798.                     if parent and parent.Person:
  799.                         weapon.ExcludeHitFor(parent)
  800.                 weapon.Impulse(0.0, 1.0, 0.0)
  801.  
  802. def CalculateFatigue(EntityName, AnimName):
  803.     me= Bladex.GetEntity(EntityName)    
  804.  
  805.     if me:
  806.         current_energy= me.Energy
  807.         if current_energy > 0.0:
  808.             
  809.             charF = 0
  810.             animF = 1.0
  811.             weaponF = 0
  812.             
  813.             #
  814.             # The ATTACK....
  815.             #
  816.             
  817.             ######################################################################################    
  818.             # We start with the weapon component #
  819.             ######################################################################################    
  820.             weaponData= None
  821.             WeaponName= me.GetInventory().GetActiveWeapon()
  822.             if not WeaponName or WeaponName==EntityName and AnimName=='g_draw_rlx' or AnimName=='g_draw_run':
  823.                 WeaponName= me.InvRightBack
  824.             
  825.             if WeaponName:    
  826.                 if Reference.EntitiesObjectData.has_key(WeaponName):
  827.                     if Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_WEAPON or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_STANDARD:
  828.                         weaponData = Reference.EntitiesObjectData[WeaponName]
  829.                         if len (weaponData) > 1:
  830.                             weaponF = weaponData[1]
  831.                 else:
  832.                     weapon= Bladex.GetEntity(WeaponName)
  833.                     if weapon:
  834.                         kind = weapon.Kind    
  835.                         if Reference.DefaultObjectData.has_key(kind):
  836.                             if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON or Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD:
  837.                                 weaponData = Reference.DefaultObjectData[kind]
  838.                                 if len (weaponData) > 1:
  839.                                     weaponF = weaponData[1]    
  840.             
  841.             ######################################################################################
  842.             
  843.             ######################################################################################
  844.             # character type components #
  845.             ######################################################################################
  846.             if netgame.GetNetState() == 0:
  847.                 charF=CharStats.GetCharDamageData(me.CharType,me.Level)
  848.             else:
  849.                 charF=NetWeapon.GetDamage(me.CharType,me.Data.NetLevel)
  850.             
  851.             ######################################################################################
  852.             # Animation component #
  853.             ######################################################################################
  854.             me.LaunchAnimation(AnimName)
  855.             # Animation component #
  856.             if AnimationData.has_key(me.AnimFullName):
  857.                 animF = AnimationData[me.AnimFullName]
  858.             elif AnimationData.has_key(me.AnimName):
  859.                 animF = AnimationData[me.AnimName]
  860.             
  861.             ######################################################################################
  862.             
  863.             lvl= me.Level+1
  864.             energy_cost= max((charF + weaponF) * animF, 0.0)+me.Data.Energy2Lose
  865.             max_energy= CharStats.GetCharMaxEnergy(me.Kind, me.Level)
  866.             me.Data.LoseEnergyRate=0.0
  867.             if PrintFatigue:
  868.                 print "energy_cost= (charF("+`charF`+") + weaponF("+`weaponF`+")) * (animF("+me.AnimFullName+"="+`animF`+") + prev_energy2lose("+`me.Data.Energy2Lose`+")= "+`energy_cost`
  869.                 print "max_energy= "+`max_energy`+", current_energy= "+`me.Energy`
  870.             if energy_cost<max_energy:
  871.                 me.Data.Energy2Lose= energy_cost
  872.                 
  873.                 if energy_cost>me.Energy:
  874.                     # Launch a clumsy animation instead
  875.                     weapon= Bladex.GetEntity(me.GetInventory().GetActiveWeapon())
  876.                     if weapon and not weapon.Person:
  877.                         weapon_flag= Reference.GiveWeaponFlag(WeaponName)
  878.                         if weapon_flag==Reference.W_FLAG_2W: clumsy_anm= "g_bad_sword"
  879.                         elif weapon_flag==Reference.W_FLAG_AXE: clumsy_anm= "g_bad_axe"
  880.                         elif weapon_flag==Reference.W_FLAG_SP: clumsy_anm= "g_bad_spear"
  881.                         else: clumsy_anm= "g_bad_1h"
  882.                     else: clumsy_anm= "g_bad_no"
  883.                     me.Wuea=Reference.WUEA_ENDED                    
  884.                     me.LaunchAnmType(clumsy_anm)
  885.                     Actions.ReportMsg ("You need more energy for this attack")
  886.                 
  887.                 try: anim_duration= Bladex.GetAnimationDuration(me.AnimFullName)
  888.                 except RuntimeError:
  889.                     print me.AnimFullName + " has not been defined for character "+ me.Kind
  890.                     anim_duration= 0.3
  891.  
  892.                 if anim_duration>0.0: me.Data.LoseEnergyRate= energy_cost / anim_duration
  893.                 else: me.Data.LoseEnergyRate= 0.0
  894.                 
  895.                 return 1
  896.             else: 
  897.                 Actions.ReportMsg ("You need more energy for this attack")
  898.                 me.Wuea=Reference.WUEA_ENDED
  899.         me.InterruptCombat()
  900.         me.RaiseEvent("Interrupt")
  901.         return 1
  902.     return 0
  903.  
  904.  
  905.  
  906. def CheckRightHandToDrop(EntityName):
  907.     me= Bladex.GetEntity(EntityName)
  908.     if not me.InvRight:
  909.         return
  910.  
  911.     two_handed_on_right=0
  912.     if Actions.IsRightHandWeaponObject(EntityName):
  913.         w_flag=Reference.GiveWeaponFlag(me.InvRight)
  914.         if w_flag<>Reference.W_FLAG_1H:
  915.             two_handed_on_right=1
  916.  
  917.     special_to_drop=0
  918.     flag=Reference.GiveObjectFlag(me.InvRight)
  919.     if flag==Reference.OBJ_KEY or flag==Reference.OBJ_SPECIALKEY or flag==Reference.OBJ_USEME:
  920.         print "right 2 drop"
  921.         special_to_drop=1
  922.  
  923.     if special_to_drop==1 or (two_handed_on_right and me.InvLeft and me.InvRight<>me.InvLeft):
  924.         if Actions.TryDropRight(EntityName):
  925.             Actions.DropReleaseEventHandler(EntityName, "DropRightEvent")
  926.             if me.InvRight:
  927.                 #print "...but did not work"
  928.                 return FALSE
  929.  
  930.  
  931.  
  932.  
  933. def CalculateDamage(VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  934.     #pdb.set_trace()
  935.  
  936.  
  937.     CheckRightHandToDrop(VictimName)
  938.  
  939.     # Additive vars set to 0
  940.     charF = 0
  941.     animF = 1.0
  942.     weaponF = 0    
  943.     randomF = 0
  944.     throwF = 0
  945.     shieldF = 0
  946.     bowF = 0
  947.     
  948.     # Multiplicative vars set to 1.0
  949.     locationF = 1.0
  950.     magicF = 1.0        
  951.     thrown_flag= 0    
  952.     
  953.     #
  954.     # The ATTACK....
  955.     #
  956.     
  957.     ######################################################################################    
  958.     # We start with the weapon component, there is always a weapon... #
  959.     ######################################################################################    
  960.     weaponData= None
  961.     if WeaponName:    
  962.         if Reference.EntitiesObjectData.has_key(WeaponName):
  963.             if Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_WEAPON or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_STANDARD or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_ARROW:
  964.                 weaponData = Reference.EntitiesObjectData[WeaponName]
  965.                 if len (weaponData) > 1:
  966.                     weaponF = weaponData[1]
  967.         else:
  968.             kind = Bladex.GetEntity(WeaponName).Kind
  969.             if Reference.DefaultObjectData.has_key(kind):
  970.                 if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON or Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD or Reference.DefaultObjectData[kind][0] == Reference.OBJ_ARROW:
  971.                     weaponData = Reference.DefaultObjectData[kind]
  972.                     if len (weaponData) > 1:
  973.                         weaponF = weaponData[1]
  974.         
  975.         if (not AttackerName) and weaponData and len (weaponData) > 2:
  976.             if PrintFormula==1:
  977.                 print "Possible thrown weapon" # get thowF from weapon
  978.             
  979.             weapon= Bladex.GetEntity(WeaponName)
  980.             if weapon:                    
  981.                 try:
  982.                     if weapon.Data and weapon.Data.ThrownBy:
  983.                         AttackerName= weapon.Data.ThrownBy.Name
  984.                         thrown_flag= 1
  985.                         if len (weaponData) > 3:
  986.                             throwF = weaponData[3]
  987.                 except AttributeError:    # No ThrownBy set, could be an arrow thrown by a trap
  988.                     if weapon.Arrow:
  989.                         thrown_flag= 1
  990.                         if len (weaponData) > 3:
  991.                             throwF = weaponData[3]
  992.                 try:
  993.                     if weapon.Person:
  994.                         AttackerName=WeaponName
  995.                 except: pass
  996.     
  997.  
  998.     ######################################################################################
  999.  
  1000.     ######################################################################################
  1001.     # Animation component, character type, level and magical components #
  1002.     ######################################################################################
  1003.     attacker= None
  1004.     if AttackerName:
  1005.         attacker=Bladex.GetEntity(AttackerName)
  1006.         
  1007.         if attacker and attacker.Person: 
  1008.             magicF = attacker.Data.FAttack
  1009.             if DamageType=="Impale" or DamageType=="Slash" or DamageType=="Crush":
  1010.                 if netgame.GetNetState() == 0:
  1011.                     charF=CharStats.GetCharDamageData(attacker.CharType,attacker.Level)
  1012.                 else:
  1013.                     charF=NetWeapon.GetDamage(attacker.CharType,attacker.Data.NetLevel)
  1014.  
  1015.             # Animation component #
  1016.             if not thrown_flag:
  1017.                 if AnimationData.has_key(attacker.AnimFullName):
  1018.                     animF = AnimationData[attacker.AnimFullName]
  1019.                     if InflictDamageFXData.has_key(attacker.AnimFullName):
  1020.                         aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch = InflictDamageFXData[attacker.AnimFullName]
  1021.                         GenFX.InflictDamageFX(VictimName, aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch)
  1022.                 elif AnimationData.has_key(attacker.AnimName):    
  1023.                     animF = AnimationData[attacker.AnimName]
  1024.                     if InflictDamageFXData.has_key(attacker.AnimFullName):
  1025.                         aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch = InflictDamageFXData[attacker.AnimFullName]
  1026.                         GenFX.InflictDamageFX(VictimName, aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch)
  1027.         
  1028.     randomF= round(whrandom.uniform(-0.05, 0.05)*charF)
  1029.     charF= max (charF + randomF, 0)
  1030.     ######################################################################################
  1031.  
  1032.     ######################################################################################
  1033.     # Damage Zone Multipliers #
  1034.     ######################################################################################
  1035.     if DamageZone==Reference.BODY_HEAD and DamageType=="Impale" and thrown_flag and weaponData[0]==Reference.OBJ_ARROW:
  1036.         locationF= 4.0
  1037.     ######################################################################################
  1038.     
  1039.     ######################################################################################
  1040.     # Shield component #
  1041.     ######################################################################################
  1042.     if AttackerName:
  1043.         shieldName= attacker.GetInventory().GetActiveShield()
  1044.         if shieldName and not thrown_flag:
  1045.             if Reference.EntitiesObjectData.has_key(shieldName):
  1046.                 if Reference.EntitiesObjectData[shieldName][0] ==  Reference.OBJ_SHIELD:
  1047.                     shieldF = Reference.EntitiesObjectData[shieldName][1]
  1048.             else:
  1049.                 kind = Bladex.GetEntity(shieldName).Kind    
  1050.                 if Reference.DefaultObjectData.has_key(kind):
  1051.                     if Reference.DefaultObjectData[kind][0] ==  Reference.OBJ_SHIELD:
  1052.                         shieldF = Reference.DefaultObjectData[kind][1]
  1053.     ######################################################################################    
  1054.     
  1055.     ######################################################################################
  1056.     # Bow component #
  1057.     ######################################################################################
  1058.     if AttackerName and attacker and attacker.GetInventory().HoldingBow and thrown_flag:
  1059.         if Reference.EntitiesObjectData.has_key(attacker.InvLeft):
  1060.             if Reference.EntitiesObjectData[attacker.InvLeft][0] ==  Reference.OBJ_BOW:
  1061.                 bowF = Reference.EntitiesObjectData[attacker.InvLeft][1]
  1062.         else:
  1063.             kind = Bladex.GetEntity(attacker.InvLeft).Kind    
  1064.             if Reference.DefaultObjectData.has_key(kind):
  1065.                 if Reference.DefaultObjectData[kind][0] ==  Reference.OBJ_BOW:
  1066.                     bowF = Reference.DefaultObjectData[kind][1]
  1067.     ######################################################################################    
  1068.     
  1069.     if AttackerName and attacker and attacker.Person:
  1070.         lvl= attacker.Level+1
  1071.     else:
  1072.         lvl=0
  1073.         
  1074.     basic_damage = ((charF * magicF * locationF) + weaponF + throwF + bowF + shieldF) * animF
  1075.     basic_damage = max( basic_damage, 0 )
  1076.     
  1077.     if PrintFormula==1:
  1078.         print "Basic Damage Formula= ((charF * magicF * locationF) + weaponF + throwF + bowF + shieldF) * animF"
  1079.         print "Basic Damage = (( "+`charF`+" * "+`magicF`+" * "+`locationF`+" ) + "+`weaponF`+" + "+`throwF`+" + "+`bowF`+" + "+`shieldF`+") * "+`animF`+" = "+`basic_damage`
  1080.     
  1081.     
  1082.     
  1083.     #
  1084.     # The DEFENSE....
  1085.     #
  1086.     
  1087.     
  1088.     # target defence #
  1089.     me=Bladex.GetEntity(VictimName)
  1090.     charF = 0
  1091.     shieldF = 0    
  1092.     weaponF = 0
  1093.     magicF = me.Data.FDefense    
  1094.     randomF = 0
  1095.     shield_breakable=0    
  1096.     victimsShieldData=None
  1097.     
  1098.     ######################################################################################
  1099.     # Shield component OR block with 2H weapon #
  1100.     ######################################################################################    
  1101.     blocking_with_weapon=0
  1102.     if Shielded:
  1103.         victimsShieldName = me.GetInventory().GetActiveShield()
  1104.         # Based on the characteristics of whatever you are carrying in the left hand
  1105.         if victimsShieldName:
  1106.             if Reference.EntitiesObjectData.has_key( victimsShieldName):
  1107.                 if Reference.EntitiesObjectData[victimsShieldName][0] ==  Reference.OBJ_SHIELD:
  1108.                     victimsShieldData= Reference.EntitiesObjectData[victimsShieldName]
  1109.                     shieldF = victimsShieldData[2]
  1110.                     shield_breakable= victimsShieldData[7]
  1111.                     
  1112.             else:
  1113.                 kind = Bladex.GetEntity(victimsShieldName).Kind
  1114.                 if Reference.DefaultObjectData.has_key(kind):
  1115.                     if Reference.DefaultObjectData[kind][0] ==  Reference.OBJ_SHIELD:
  1116.                         victimsShieldData= Reference.DefaultObjectData[kind]
  1117.                         shieldF = Reference.DefaultObjectData[kind][2]
  1118.                         shield_breakable=Reference.DefaultObjectData[kind][7]
  1119.             
  1120.         else:
  1121.             # Blocking with a weapon
  1122.             victimsWeaponName = me.InvRight
  1123.             if not victimsWeaponName or victimsWeaponName=="" or victimsWeaponName=="None":
  1124.                 print "Unexpected error in CalculateDamage"
  1125.                 print "Blocking but nothing in hands?"
  1126.                 return
  1127.             w_weapon=Bladex.GetEntity(victimsWeaponName)
  1128.             w_flag=Reference.GiveObjectFlag(victimsWeaponName)
  1129.             if w_flag<>Reference.OBJ_WEAPON:
  1130.                 print "Error in CalculateDamage"
  1131.                 print "Blocking with an unexpected type of weapon"
  1132.                 return
  1133.              
  1134.             if Reference.EntitiesObjectData.has_key( victimsWeaponName):
  1135.                 victimsShieldData=Reference.EntitiesObjectData[victimsWeaponName]
  1136.             else:
  1137.                 kind = Bladex.GetEntity(victimsWeaponName).Kind
  1138.                 if Reference.DefaultObjectData.has_key(kind):
  1139.                     victimsShieldData=Reference.DefaultObjectData[kind]
  1140.  
  1141.             if not victimsShieldData or len(victimsShieldData[5])<1 or victimsShieldData[5][0]==Reference.W_FLAG_1H:
  1142.                 print "Error in CalculateDamage"
  1143.                 print "Trying to wblock with a one handed weapon!"
  1144.             else:                
  1145.                 shieldF = victimsShieldData[5][4]
  1146.                 shield_breakable=victimsShieldData[5][5]
  1147.                 blocking_with_weapon=1
  1148.  
  1149.     ######################################################################################    
  1150.     
  1151.     ######################################################################################
  1152.     # Character Type component #
  1153.     ######################################################################################
  1154.  
  1155.     if netgame.GetNetState() == 0:
  1156.         charF= CharStats.GetCharDefenseData(me.CharType,me.Level) + me.Data.armour_prot_factor
  1157.     else:
  1158.         charF=NetWeapon.GetDefense(me.CharType,me.Data.NetLevel)
  1159.     
  1160.     randomF= round(whrandom.uniform(-0.05, 0.05)*charF)
  1161.     charF=  max(charF+randomF, 0)
  1162.     ######################################################################################
  1163.     
  1164.     ######################################################################################
  1165.     # Weapon component #
  1166.     ######################################################################################
  1167.     victimsWeaponData= None
  1168.     if me.GetInventory().HoldingBow:
  1169.         victimsWeaponName = me.InvLeft
  1170.     else:
  1171.         victimsWeaponName = me.InvRight
  1172.     if victimsWeaponName and blocking_with_weapon==0:    
  1173.         if Reference.EntitiesObjectData.has_key(victimsWeaponName):
  1174.             if Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_WEAPON or Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_STANDARD or Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_ARROW or Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_BOW:
  1175.                 victimsWeaponData = Reference.EntitiesObjectData[victimsWeaponName]
  1176.                 if len (victimsWeaponData) > 2:
  1177.                     weaponF = victimsWeaponData[2]
  1178.         else:
  1179.             kind = Bladex.GetEntity(victimsWeaponName).Kind    
  1180.             if Reference.DefaultObjectData.has_key(kind):
  1181.                 if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON or Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD or Reference.DefaultObjectData[kind][0] == Reference.OBJ_ARROW  or Reference.DefaultObjectData[kind][0] == Reference.OBJ_BOW:
  1182.                     victimsWeaponData = Reference.DefaultObjectData[kind]
  1183.                     if len (victimsWeaponData) > 2:
  1184.                         weaponF = victimsWeaponData[2]
  1185.     ######################################################################################
  1186.     
  1187.     DEF= (charF * magicF) + shieldF + weaponF    
  1188.     effective_damage = basic_damage - DEF
  1189.     effective_damage = max( effective_damage, 0 )
  1190.  
  1191.  
  1192.     if PrintFormula==1:
  1193.         print "Effective Damage Formula = basic_damage - (charF * magicF) - shieldF - weaponF"
  1194.         print "Effective Damage Formula = "+`basic_damage`+" - ( "+`charF`+" * "+`magicF`+" ) - "+`shieldF`+" - "+`weaponF`+" = "+`effective_damage`
  1195.  
  1196.     if Shielded:
  1197.         damage_withstood= int (max (basic_damage - (DEF-shieldF), 0))
  1198.         if not blocking_with_weapon:
  1199.             shield= Bladex.GetEntity(me.GetInventory().GetActiveShield())
  1200.             try:
  1201.                 if shield and shield_breakable:
  1202.                     # Lower the resistance of the shield
  1203.                     if victimsShieldData:
  1204.                         if not Reference.EntitiesObjectData.has_key(shield.Name):
  1205.                             Reference.EntitiesObjectData[shield.Name]= copy.copy(victimsShieldData)
  1206.                             victimsShieldData= Reference.EntitiesObjectData[shield.Name]
  1207.                         victimsShieldData[2]= victimsShieldData[2]-damage_withstood
  1208.                         
  1209.                         # Break the shield if 0 resistance
  1210.                         if victimsShieldData[2] <= 0.0:
  1211.                             victimsShieldData[2]=0.0
  1212.                             if shield.Data.brkobjdata:
  1213.                                 BreakMyShield(me.Name)
  1214.                                 Shielded=0
  1215.                         elif attacker and attacker.InDestructorAttack==1 and damage_withstood > shield_breakable:
  1216.                             if shield.Data.brkobjdata:
  1217.                                 BreakMyShield(me.Name)
  1218.                                 Shielded=0
  1219.                                 if PrintFormula==1:
  1220.                                     print "Shield Breaking in destructor attack, took: "+`damage_withstood`+", max: "+`shield_breakable`
  1221.                         else:
  1222.                             if (not thrown_flag) and attacker and attacker.Person and attacker.GotAnmType("sw_react"):
  1223.                                 attacker.Wuea=Reference.WUEA_ENDED
  1224.                                 attacker.LaunchAnmType("sw_react")
  1225.  
  1226.             except AttributeError: pass
  1227.             try:
  1228.                 if shield and shield.Data and shield.Data.AbsorbFunc:
  1229.                     shield.Data.AbsorbFunc (AttackerName, WeaponName, damage_withstood)
  1230.             except AttributeError: pass
  1231.         else:                        
  1232.             weapon= Bladex.GetEntity(me.GetInventory().GetActiveWeapon())
  1233.             try:
  1234.                  if weapon and weapon.Data.brkobjdata:
  1235.                      # Lower the resistance of the shield
  1236.                      if victimsShieldData:
  1237.                          if not Reference.EntitiesObjectData.has_key(weapon.Name):
  1238.                              Reference.EntitiesObjectData[weapon.Name]= copy.copy(victimsShieldData)
  1239.                              victimsShieldData= Reference.EntitiesObjectData[weapon.Name]
  1240.                          victimsShieldData[5][4]= victimsShieldData[5][4]-damage_withstood
  1241.                          
  1242.                          # Break the shield if 0 resistance
  1243.                          if victimsShieldData[5][4] <= 0.0:
  1244.                              victimsShieldData[5][4]=0.0
  1245.                              if weapon.Data.brkobjdata:
  1246.                                 BreakMySword(me.Name)
  1247.                                 Shielded=0
  1248.                         elif attacker and attacker.InDestructorAttack==1 and damage_withstood > shield_breakable:
  1249.                             if weapon.Data.brkobjdata:
  1250.                                 BreakMySword(me.Name)
  1251.                                 Shielded=0
  1252.                                 if PrintFormula==1:
  1253.                                     print "Weapon Breaking in destructor attack, took: "+`damage_withstood`+", max: "+`shield_breakable`
  1254.             except AttributeError: pass
  1255.             try:
  1256.                 if weapon and weapon.Data and weapon.Data.AbsorbFunc:
  1257.                     weapon.Data.AbsorbFunc (AttackerName, WeaponName, damage_withstood)
  1258.             except AttributeError: pass
  1259.  
  1260.  
  1261.     # personal magical resistance can reduce this damage
  1262.     damage_resistance= me.Data.GetResistance(DamageType)
  1263.     if damage_resistance > 0.0:
  1264.         if PrintFormula==1:
  1265.             print "Resistance to "+DamageType+" at "+`damage_resistance`+" reduces the effective_damage to "+`effective_damage*(1.0-damage_resistance)`
  1266.         effective_damage= effective_damage*(1.0-damage_resistance)
  1267.     
  1268.     # store the damage type for later processing
  1269.     if effective_damage>0:
  1270.         me.Data.LastDamageType= DamageType
  1271.     
  1272.     # special damage e.g. Fire, poison,
  1273.     special_damage= 0.0    
  1274.     if not (Shielded and effective_damage<=0):
  1275.         if weaponData and len (weaponData) > 6:
  1276.             for special in weaponData[6:]:
  1277.                 special_resistance= me.Data.GetResistance(special[0])
  1278.                 
  1279.                 if SpecialDamageFuncs.has_key(special[0]):
  1280.                     special_damage_func= SpecialDamageFuncs[special[0]]
  1281.                     special_damage= special_damage + special_damage_func (special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded)
  1282.                     if PrintFormula==1:
  1283.                         print "Special damage type "+`special[0]`+" (resisted at "+`special_resistance`+") adds "+`special_damage`+" to effective damage."
  1284.                 else:
  1285.                     if PrintFormula==1:
  1286.                         print "Special damage type "+`special[0]`+" (resisted at "+`special_resistance`+") adds "+`special[1]`+" to effective damage."
  1287.                     special_damage= special_damage + special[1]*(1.0-special_resistance)
  1288.         
  1289.         effective_damage= effective_damage + special_damage
  1290.     
  1291.     if(not Shielded) and (DamageType=="Impale" or DamageType=="Slash") and Bladex.GetBloodLevel()>0:
  1292.         me.Data.TakeBleedingImpact= effective_damage
  1293.     else:
  1294.         me.Data.TakeBleedingImpact= 0
  1295.     
  1296.     prevLife=me.Life
  1297.     
  1298.     if not me.Data.Invincibility:
  1299.         me.Life= me.Life - effective_damage
  1300.     
  1301.     if effective_damage>0:
  1302.         me.Data.Mutilate= me.Life <= 0 and DamageType=="Slash"
  1303.     else:
  1304.         me.Data.Mutilate= 0
  1305.         if not Shielded:
  1306.             effective_damage=1.0
  1307.             
  1308.     if thrown_flag==1:
  1309.         try: me.Data.Respond2Thrown(me.Name,AttackerName)
  1310.         except AttributeError: pass
  1311.  
  1312.     me.Data.RespondToHit(me.Name, AttackerName, effective_damage, DamageType, DamageZone, Shielded)
  1313.     
  1314.     if PlayerHitFunc !="":
  1315.         PlayerHitFunc( VictimName, AttackerName, me.Life, prevLife)
  1316.  
  1317.     if me.Life <= 0.0:
  1318.         if (AttackerName):
  1319.             attacker=Bladex.GetEntity(AttackerName)
  1320.             if attacker and attacker.InDestructorAttack==1 and effective_damage>1:
  1321.                 try:
  1322.                     if victimsShieldName:
  1323.                         victimsShield= Bladex.GetEntity(victimsShieldName)
  1324.                         if victimsShield and victimsShield.Data.brkobjdata:
  1325.                             BreakMyShield(me.Name)
  1326.                 except:
  1327.                     pass
  1328.                 try:
  1329.                     if victimsWeaponName:
  1330.                         victimsWeapon= Bladex.GetEntity(victimsWeaponName)
  1331.                         if victimsWeapon and victimsWeaponName.Data.brkobjdata:
  1332.                             BreakMySword(me.Name)
  1333.                 except:
  1334.                     pass
  1335.             if (prevLife>0) and (netgame.GetNetState() == 0):
  1336.                 AttackerEntity=Bladex.GetEntity(AttackerName)
  1337.                 if AttackerEntity:
  1338.                     AttackerEntity.Data.OnKilledEnemy(VictimName)
  1339.  
  1340.     # Sticking to player
  1341.     # Check type of weapon
  1342.     if thrown_flag and weapon.Arrow:
  1343.         weapon.MessageEvent(Reference.MESSAGE_STOP_WEAPON,0,0)
  1344.         weapon.MessageEvent(Reference.MESSAGE_STOP_TRAIL,0,0)
  1345.         weapon.Stop(x, y, z)
  1346.         # Check type of damage
  1347.         if me and (not me.Data.Mutilate) and DamageNode!=-1 and DamageZone!=Reference.BODY_HEAD and me.Life>0.0:
  1348.             me.LinkToNode(weapon, DamageNode)
  1349.             sticktime= (3.0)/weapon.Mass
  1350.             print "object "+weapon.Name+" of kind "+weapon.Kind+" of mass "+`weapon.Mass`+" sticking for "+`sticktime`+" seconds"
  1351.             Bladex.AddScheduledFunc (Bladex.GetTime()+sticktime, StuckWeaponFall, (weapon.Name, VictimName), weapon.Name+"_StuckWeaponFall")
  1352.             if weapon.StickFunc:
  1353.                 weapon.StickFunc (weapon.Name, me.Name)
  1354.         else:
  1355.             weapon.Impulse (0.0,1.0,0.0)
  1356.             
  1357.     if me.Data.Mutilate:
  1358.         if PrintFormula==1:
  1359.             print "Mutilation"
  1360.     if Bladex.GetMutilationLevel()==0:
  1361.         return 0
  1362.     else:
  1363.         return me.Data.Mutilate    
  1364.